from pyecharts.charts import Bar,Timeline
from pyecharts.options import *
from pyecharts.globals import ThemeType
bar1 = Bar()
bar1.add_xaxis(["中国","美国","俄罗斯"])
bar1.add_yaxis("GDP",[30,20,10],label_opts=LabelOpts(
    position="right"
))
# 翻转X轴和Y轴
bar1.reversal_axis()

bar2 = Bar()
bar2.add_xaxis(["中国","美国","俄罗斯"])
bar2.add_yaxis("GDP",[300,200,100],label_opts=LabelOpts(
    position="right"
))
# 翻转X轴和Y轴
bar2.reversal_axis()

bar3 = Bar()
bar3.add_xaxis(["中国","美国","俄罗斯"])
bar3.add_yaxis("GDP",[300,200,100],label_opts=LabelOpts(
    position="right"
))
# 翻转X轴和Y轴
bar3.reversal_axis()

# 构建时间线对象
timeLine = Timeline(
    {"theme":ThemeType.LIGHT}
)
timeLine.add(bar1,"2000")
timeLine.add(bar2,"2010")
timeLine.add(bar3,"2020")
# 设置自动播放
timeLine.add_schema(
    play_interval=1000,
    is_timeline_show=True,
    is_auto_play=True,
    is_loop_play=True,

)
timeLine.render("时间线柱状图.html")